package pl.edu.agh.sius.clients;

import javax.xml.ws.BindingProvider;

import pl.edu.agh.siusbox.tempbenefit.schema.TemporaryBenefitRequest;
import pl.edu.agh.siusbox.tempbenefit.service.CanonicServiceForclient;
import pl.edu.agh.siusbox.tempbenefit.service.Forclient;


public class TempBenefitWSClient 
{
    public static void main( String[] args )
    {
      
    	TempBenefitWSClient client=new TempBenefitWSClient();
    	TemporaryBenefitRequest tbr=new TemporaryBenefitRequest();
    	tbr.setAddress("a");
		tbr.setFirstName("a");
		tbr.setPesel("a");
		tbr.setSurname("a");
		tbr.setStatementOfEarningsDocURL("a");
		tbr.setTempBenefitPetitionDocURL("b");
		
		client.invoke(tbr, "127.0.0.1");
    	
    	
    }
     
    public void invoke(TemporaryBenefitRequest esr, String ip) {

		Forclient fc = new CanonicServiceForclient().getCanonicPort();
		BindingProvider pb = ((BindingProvider) fc);
		pb
				.getRequestContext()
				.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
						"http://" + ip + ":8080/ode/processes/TemporaryBenefits/TemporaryBenefit/tempBenefit/client");
		fc.start(esr);
		System.out.println("TempBenefit webservice invoked");
	
	}
	
}
